package com.pomr.model.data;
/**
 * 血压计 数据
 * @author Administrator
 *
 */
public class GXYData implements ObjectData{
	public String getGy() {
		return gy;
	}
	public void setGy(String gy) {
		this.gy = gy;
	}
	public String getDy() {
		return dy;
	}
	public void setDy(String dy) {
		this.dy = dy;
	}
	public String getXlv() {
		return xlv;
	}
	public void setXlv(String xlv) {
		this.xlv = xlv;
	}
	private String gy;//高压 3
	private String dy;//低压 3
	private String xlv;//心率 3
	
	public static GXYData getInitializtion(String dataStr){
		GXYData gxy = new GXYData();
		int startLoc = 0;
		String childStr = null;
		gxy.gy = dataStr.substring(0, 3);
		startLoc += 3;
		childStr = dataStr.substring(startLoc);
		gxy.dy = childStr.substring(0,3);
		startLoc += 3;
		childStr = dataStr.substring(startLoc);
		gxy.xlv = childStr.substring(0,3);
		return gxy;
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("血压计：{\n");
		sb.append("	高压:"+this.gy+"\n");
		sb.append("	低压:"+this.dy+"\n");
		sb.append("	心率:"+this.xlv+"\n");
		sb.append("}\n");
		return sb.toString();
	}
	
	public String toXML(){
		StringBuilder sb = new StringBuilder();
		sb.append("<Option>");
			sb.append("<legendtitle>");
			sb.append("高血压高值,高血压低值,心率");
			sb.append("</legendtitle>");
			sb.append("<legends>");
				sb.append("<legend>");
					sb.append("<title>");
					sb.append("高血压高值");
					sb.append("</title>");
					sb.append("<data>");
					sb.append(this.gy);
					sb.append("</data>");
					sb.append("<aver>");
					sb.append("false");
					sb.append("</aver>");
				sb.append("</legend>");
				sb.append("<legend>");
					sb.append("<title>");
					sb.append("高血压低值");
					sb.append("</title>");
					sb.append("<data>");
					sb.append(this.dy);
					sb.append("</data>");
					sb.append("<aver>");
					sb.append("false");
					sb.append("</aver>");
				sb.append("</legend>");
				sb.append("<legend>");
					sb.append("<title>");
					sb.append("心率");
					sb.append("</title>");
					sb.append("<data>");
					sb.append(this.xlv);
					sb.append("</data>");
					sb.append("<aver>");
					sb.append("false");
					sb.append("</aver>");
				sb.append("</legend>");
			sb.append("</legends>");
		sb.append("</Option>");
		return sb.toString();
	}

}
